package com.example.leepong.Game.Entities;

import com.example.leepong.Game.Shapes.FixedRectangle;
import com.example.leepong.Game.Shapes.Rectangle;

/**
 * Created by Ichigo on 28/02/14.
 */
public class Score {
    public FixedRectangle Rect;
    public int Points;
    public int BaseGlow;
    public int Glow;
    private int glowSleep;

    public Score(Rectangle rect) {
        this.Rect = new FixedRectangle(rect);
        this.BaseGlow = (int) Math.round(0.4 * Rect.Width);
    }

    public void Increment() {
        this.Points++;
        this.DoGlow();
    }

    public void DoGlow() {
        this.Glow = BaseGlow;
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                GlowAction();
            }
        });
        thread.start();
    }

    private void GlowAction() {
        int i = 0;
        while (this.Glow > 0) {
            i++;
            this.Glow = (int) Math.floor(this.Glow - (20.0 / this.Glow));
            try {
                Thread.sleep(15);
            } catch (InterruptedException ex) {
            }
        }
    }
}
